﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using KPIS.GERP.GIMS.MODEL;
using KPIS.GERP.GIMS.DAL;
using KPIS.GERP.GIMS.DALFactory;
using KPIS.DBM;

namespace KPIS.GERP.GIMS.BLL
{
    public class PurchaseOrderBLL
    {
        private static readonly PurchaseOrderDAL dal = DataAccess.CreatePurchaseOrder();

        public IList<PurchaseOrderInfo> GetPurchaseOrder(Nullable<int> YearTypeSeq, Nullable<int> Year, Nullable<int> PurchaseMethodSeq
            , Nullable<int> PurchaseTypeSeq, Nullable<int> OperationNameSeq, Nullable<int> Status)
        {
            return dal.GetPurchaseOrder(YearTypeSeq, Year, PurchaseMethodSeq, PurchaseTypeSeq, OperationNameSeq, Status);
        }

        public IList<PurchaseOrderInfo> GetPurchaseOrderInstallment(Nullable<int> YearTypeSeq, Nullable<int> Year, Nullable<int> PurchaseMethodSeq
            , Nullable<int> PurchaseTypeSeq, Nullable<int> OperationNameSeq, Nullable<int> Status)
        {
            return dal.GetPurchaseOrderInstallment(YearTypeSeq, Year, PurchaseMethodSeq, PurchaseTypeSeq, OperationNameSeq, Status);
        }

        public IList<PurchaseOrderInfo> GetPurchaseOrderContract(Nullable<int> YearTypeSeq, Nullable<int> Year, Nullable<int> PurchaseMethodSeq
            , Nullable<int> PurchaseTypeSeq, Nullable<int> OperationNameSeq, Nullable<int> Status)
        {
            return dal.GetPurchaseOrderContract(YearTypeSeq, Year, PurchaseMethodSeq, PurchaseTypeSeq, OperationNameSeq, Status);
        }

        public PurchaseOrderInfo GetPurchaseOrderDetail(int Seq)
        {
            return dal.GetPurchaseOrderDetail(Seq);
        }

        public string Insert(PurchaseOrderInfo infoPo, IList<PurchaseOrderInstallmentItemInfo> infoListInstallItem, IList<PurchaseOrderCommitteeInfo> infoListPoCommittee, IList<PurchaseOrderPenaltyInfo> infoListPoPenalty, IList<DocumentInfo> infoListDocument)
        {
            return dal.Insert(infoPo, infoListInstallItem, infoListPoCommittee, infoListPoPenalty, infoListDocument);
        }

        public string InsertWithInstallment(PurchaseOrderInfo info, IList<PurchaseOrderCommitteeInfo> infoListCommittee, IList<PurchaseOrderPenaltyInfo> infoListPenalty, IList<PurchaseOrderInstallmentInfo> infoListInstallment, IList<DocumentInfo> infoListDocument)
        {
            return dal.InsertWithInstallment(info, infoListCommittee, infoListPenalty, infoListInstallment, infoListDocument);
        }

        public string InsertContract(PurchaseOrderInfo info, IList<PurchaseOrderCommitteeInfo> infoListCommittee, IList<PurchaseOrderPenaltyInfo> infoListPenalty, IList<PurchaseOrderInstallmentInfo> infoListInstallment, IList<PurchaseOrderCollateralInfo> infoListCollateral, IList<DocumentInfo> infoListDocument)
        {
            return dal.InsertContract(info, infoListCommittee, infoListPenalty, infoListInstallment, infoListCollateral, infoListDocument);
        }

        public void Update(PurchaseOrderInfo info)
        {
            dal.Update(info);
        }

        public void DeleteAll(IList<PurchaseOrderInfo> infoList)
        {
            dal.DeleteAll(infoList);
        }

        public void UpdatePurchaseOrderStatus(int po_seq, string Status)
        {
            dal.UpdatePurchaseOrderStatus(po_seq, Status);
        }

        public string UpdateTotalAndAmountConfirm(PurchaseOrderInfo info, IList<PrePurchaseRequestItemInfo> infoListPprItem, IList<PurchaseOrderRouteInfo> infoListRoute)
        {
            return dal.UpdateTotalAndAmountConfirm(info, infoListPprItem, infoListRoute);
        }

        public void Confirm(PurchaseOrderInfo info, IList<PurchaseOrderRouteInfo> infoListRoute, IDBManager dbManagerTrans)
        {
            dal.Confirm(info, infoListRoute, dbManagerTrans);
        }
    }
}
